//
//  HMAlertView.m
//  HeartMark
//
//  Created by rimi on 16/11/7.
//  Copyright © 2016年 黄华强. All rights reserved.
//

#import "HMAlertView.h"

@implementation HMAlertView

+ (void)bottomAlertView:(NSString *)title {
    
    CGFloat maxY = SCREEN_HEIGHT/2 + 22;
    //初始化一个标签视图
    HMUILabel *label = [[HMUILabel alloc]initWithTitle:title Color:[UIColor whiteColor] FontSize:17 LayoutWidth:0];
    
    label.frame = CGRectMake(0, 0, 150, 44);
    label.center = CGPointMake(SCREEN_WIDTH/2, maxY - 22);
    label.backgroundColor = [UIColor blackColor];
    label.alpha = 0.0;
    label.textAlignment = NSTextAlignmentCenter;
    label.layer.cornerRadius = 5;
    label.layer.masksToBounds = YES;
    
    //将视图添加到window上
    [[[UIApplication sharedApplication] keyWindow] addSubview:label];
    //动画
    [UIView animateWithDuration:1.0 animations:^{
        label.alpha = 1.0;
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:1.5 animations:^{
            label.alpha = 0.0;
        } completion:^(BOOL finished) {
            [label removeFromSuperview];
        }];
    }];
    
}


@end
